<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Model_user extends CI_Model{
	function __construct(){
		parent::__construct();
		$this->load->database();
	}
	function insert($arr){
		return $this->db->insert("user",$arr)==true;
	}
	function update($arr){
		$this->db->where("uid",$arr["uid"]);
		return $this->db->update('user',$arr)==true;
	}
	function check($uname,$password){
		$sql = "select * from user where uname = ? AND  password = ?";
		return $this->db->query($sql,array($uname,$password))->result();
	}
	function find_name($uname){
		$sql = "select * from user where uname = ?";
		return $this->db->query($sql,array($uname))->result();
	}
	function set_header($file_name){
		$sql = "update user set header = ? where id = ?";
		return $this->db->query($sql)?"true":"false";
	}
}